//
//  LHTopicsTableViewCell.m
//  EPA
//
//  Created by 卢浩 on 16/4/18.
//  Copyright © 2016年 卢浩. All rights reserved.
//

#import "LHTopicsTableViewCell.h"
#import "LHNetWorkRequestManager.h"

@interface LHTopicsTableViewCell ()


@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentImgViewHeight;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentLableLeft;
@end

@implementation LHTopicsTableViewCell

- (void)setModel:(LHTopicsModel *)model{
    if (_model != model) {
        _model = model;
    }
}

- (IBAction)shareAction:(id)sender {
    
}

- (void)layoutSubviews{
//    NSLog(@"%@,%@",self.model.coverimg,self.model.content);
    if (self.model.coverimg.length == 0 && self.model.content.length == 0) {
        self.contentImgViewHeight.constant = 0;
    }else if(self.model.coverimg.length == 0 && self.model.content.length > 0){
        self.contentImgView.hidden = YES;
        self.contentLableLeft.constant = 15;
    }
    self.titleLable.text = self.model.title;
    self.contentLable.text = self.model.content;
    self.nameLable.text = self.model.userinfo[@"uname"];
    self.joinNumLable.text = [NSString stringWithFormat:@"%d",[self.model.counterList[@"view"] intValue]];
    self.commentNumLable.text = [NSString stringWithFormat:@"%d",[self.model.counterList[@"comment"] intValue]];
    self.likeNumLable.text = [NSString stringWithFormat:@"%d",[self.model.counterList[@"like"] intValue]];
    [self.contentImgView sd_setImageWithURL:[NSURL URLWithString:self.model.coverimg]];
    [self.iconImgView sd_setImageWithURL:[NSURL URLWithString:self.model.userinfo[@"icon"]]];
}

@end
